package edu.spec.sys.util;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * Created by MadFrog on 2017/7/23.
 */
public class DateConverter implements Converter {

    @Override
    public Object convert(Object o) {
        String stringDate = (String)o;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            return simpleDateFormat.parse(stringDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

}
